package com.zzl.car.controller;

import com.alibaba.fastjson.JSON;
import com.alipay.api.domain.Instance;
import com.zzl.car.entity.LoveCarScore;
import com.zzl.car.service.ZzwLoveCarScoreService;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.javassist.expr.Instanceof;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class ZzwLoveCarScoreController {

    @Autowired
    private ZzwLoveCarScoreService love;

    @PostMapping("/modifyLoveCarScore")
/*    public String modifyLoveCarScore(@RequestParam(value = "form1") LoveCarScore love1,
                                     @RequestParam(value = "form2") LoveCarScore love2,
                                     @RequestParam(value = "form3") LoveCarScore love3){*/
    public String modifyLoveCarScore(@RequestBody Map<String,LoveCarScore> map){

        if(map.size() == 3)
            return love.three(map);
        else if(map.size() == 4)
            return love.four(map);
        return love.five(map);
    }

    @PostMapping("/getLoveCarScore")
    public List<LoveCarScore> getLoveCarScore (){
        return love.getLoveCarScore();
    }

}
